//
//  BaseTableViewController.swift
//  我的微博
//
//  Created by H on 15/7/28.
//  Copyright © 2015年 H. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController ,VisitorLoginViewDelegate{

    var userLogon = UserAccount.sharedUserAccount != nil
//    var userLogon = UserAccount.userLogon
   var visitorView:VisitorLoginView?
    override func loadView() {
        userLogon ? super.loadView() :setupVisitorView()
    }
    private func setupVisitorView() {
    visitorView = VisitorLoginView()
        visitorView?.delegate = self
        view = visitorView
        //添加导航栏按钮
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorLoginViewWillRegister")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorLoginViewWillLogin")
    
    
    }
    func visitorLoginViewWillLogin() {
        
    let nav = UINavigationController(rootViewController: OAuthViewController())
        presentViewController(nav, animated: true, completion: nil)
    }
    
    func visitorLoginViewWillRegister() {
        print("注册")
    }
}
